﻿@model List<ScrumPilot.Domain.Models.WorkItem>
@if (Model != null && Model.Any())
{
    Boolean isAdmin = ScrumPilot.Helpers.SPHelpers.IsAdmin(int.Parse(this.User.Identity.Name));

    if (ViewBag.WILType == 2)
    {
    <h3>
        Scoring WorkItemSimpleForUsers list</h3>
    }
    else
    {
    <h3>
        WorkItemSimpleForUsers list</h3>
    }
    <ul>
        @foreach (var item in Model)
        {
            <li>
                <table style="width: 100%">
                    <tr>
                        <td style="width: 80%">
                            <h2>
                                @item.Name
                                @if (item.ParentType.ToLower() == "bug")
                                {
                                    <img alt="bug" src="@Url.Content("~/Content/img/bug.png")" />
                                }
                            </h2>
                            <p class="ZeroPad">
                                @item.Description</p>
                            <p style="padding: 3px 0 0 0; margin: 0">
                                Assigned to: <a href="@Url.Action("UserView", "Home")/@item.AssignedToID">@item.AssignedTo</a>
                            </p>
                            <p class="ZeroPad" style="font-size: 8pt">
                                last modification:
                                <abbr class='timeago' title='@item.ISO8601Date'>@item.LastModifiedDate</abbr>
                            </p>
                        </td>
                        <td style="vertical-align: top">
                            <div class="scorediv MetroButton" title="Score">
                                <p class="ZeroPad">
                                    @item.Score</p>
                            </div>
                            @if (isAdmin)
                            {
                                <a class="MetroButton" title="Set score" href="#" onclick="return setScore(@item.ID,@item.Score);">
                                    <img src="@Url.Content("~/Content/img/settings24.png")" alt="Set score"/>
                                </a>}
                            <a class="MetroButton" title="Edit" href="#">
                                <img src="@Url.Content("~/Content/img/edit24.png")" alt="Edit"/>
                            </a>
                        </td>
                    </tr>
                </table>
            </li>        
        }
    </ul>
}
else
{
    <h3>
        No WorkItemSimpleForUser</h3>
}
